package org.batch.config.batch.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.stereotype.Component;

/**
 * 批处理监听器
 *
 * @author LiKun
 * @date 2021/9/27 11:06
 */
@Component("batchListener")
public class BatchListener implements JobExecutionListener {
    private static final Logger logger = LoggerFactory.getLogger(BatchListener.class);

    @Override
    public void beforeJob(JobExecution jobExecution) {
        logger.info("任务执行开始: {}", jobExecution.toString());
    }

    @Override
    public void afterJob(JobExecution jobExecution) {
        logger.info("任务执行结束: {}", jobExecution.toString());
    }
}
